import QtQuick 1.1
import com.meego 1.0
import "Modulelib.js" as ModuleUtil
import "CommomUtil.js" as Util

Item {
    id: container

//    property alias letter: title.text

    property int letter_fontSize: 22

//    property alias letterModel: item_show.model

    property string itemType: "item"

    property string itemName: ""

    property alias itemImg: item_image.source

    property string itemFLetter: ""

    property string itemId: "0"

    width: 480; height: 60

//    Item {
//        id: item_letter
//        width: parent.width; height: container.itemType === "item" ? 0 : parent.height
//        opacity: container.itemType === "item" ? 0 : 1
//        BorderImage {
//            id: titlebar_back
//            source: "../images/modelslib/line.png"
//            width: parent.width; height: 38
//        }

//        Text {
//            id: title
//            color: "#f7f0f0"
//            font.bold: true; font.pointSize: container.letter_fontSize;
//            anchors.fill: titlebar_back; anchors.leftMargin: 20
//            verticalAlignment: Text.AlignVCenter
//        }

//    }

        Item {
            id: item_value
            width: container.width
            height:  parent.height

            BorderImage {
                id: item_back
                source: "../images/modelslib/listBack.png"
                anchors.fill: parent
            }

            Image {
                id: item_image
                height: parent.height - 10; width: parent.height - 10
                source: container.img === "" ? "../images/modelslib/listBack.png" : img
                anchors.left: parent.left; anchors.leftMargin: 40
                anchors.top: parent.top; anchors.topMargin: 5
            }

            Text {
                id: label
                anchors.left: item_image.right; anchors.leftMargin: 20;
                anchors.top: parent.top;
                height: parent.height
                text: "("+container.itemFLetter+")"+container.itemName
                horizontalAlignment : Text.AlignLeft
                verticalAlignment: Text.AlignVCenter
                color: "#7a7575"
                font.bold: true
                font.pointSize: 18
            }

            MouseArea{
                id: itemMouseArea
                anchors.fill: parent
                onClicked: {
                    ModuleUtil.current_module_id = container.itemId;
                    ModuleUtil.current_module_name = container.itemName;
                    mainPage.pageStack.push(Qt.resolvedUrl("ModuleVehiclesPage.qml"));//转入车系列表页面
                }
            }

            states: [
                State {
                    name: 'pressed'; when: itemMouseArea.pressed
                    PropertyChanges { target: mouseAreaPressed; focus: true; opacity: 0.5}
                }
            ]

        }

        Rectangle{
            id: mouseAreaPressed
            anchors.fill: parent
            color: "#000"
            opacity: 0
        }
}

